/*客户端*/

#include "head.h"

/*ls指令，成功返回0，失败返回-1*/
int op_ls(Client *p_cli, int fd_serv){
    //todo
    int ret = send(fd_serv, p_cli, sizeof(*p_cli), 0);
    if(ret == -1){
        //todo
        printf("send failed\n");
        return -1;
    }

    memset(&p_cli->cmd, 0, sizeof(p_cli->cmd));
    memset(&p_cli->file, 0, sizeof(p_cli->file));

    ret = recv(fd_serv, p_cli, sizeof(*p_cli), MSG_WAITALL);
        //ret check
    char buf[OP_BUF_SIZE] = {0};
    ret = recv(fd_serv, buf, p_cli->file.file_size, MSG_WAITALL);
        //ret check

    puts(buf);
    return 0;
}

